/**
 * 简单销售出库单
 */
import request from '@/utils/httpRequest.js';
import axiosRequest from "@/utils/axiosRequest.js";

/**
 * 2025-03-26
 */


//分页查询销售订单列表信息
export function reqPurchaseReceiptsList(parameter){
    return request({
        url:"/saleOutReceipt/list",
        method:"post",
        data:{
            page:parameter.page,
            size:parameter.size,
            saleOrderNumber:parameter.saleOrderNumber,
            customFieldOne: parameter.customFieldOne
        }
    })
}

// 获取销售订单详情
export function reqSaleOutReceiptsDetail(parameter){
    return request({
        url:"/saleOutReceipt/detail",
        method:"get",
        params:{
            saleOrderNumber:parameter.saleOrderNumber
        }
    })
}

// 获取销售订单bom物料
export function reqWorkOrderReceiptsBom(parameter){
    return request({
        url:"/saleOutReceipt/bom",
        method:"get",
        params:{
            saleOrderNumber:parameter.saleOrderNumber
        }
    })
}


//获取当前申请人
export function reqCurrentPerson(){
    return request({
        url:"/api/users/current",
        method:"get"
    })
}

//获取申请人列表信息
export function reqUserList(){
    return request({
        url:"/api/users/list",
        method:"get",
        params:{
            page:1,
            size:100,
            nickname:""
        }
    })
}

//获取默认销售出库单号
export function reqDefaultPurchaseCode(){
    return request({
        url:"/saleOutReceipt/seCode",
        method:"get"
    })
}


//获取仓库列表信息
export function reqWarehouseList(){
    return request({
        url:"/saleOutReceipt/warehouse/all",
        method:"get"
    })
}
//获取生产领料出库单状态数量
export function reqWorkOrderStatusNum(){
    return request({
        url:"/saleOutReceipt/menu/num",
        method:"get"
    })
}
//获取销售出库单列表
export function reqSaleOutReceiptList(parameter){
    return request({
        url:"/saleOutReceipt/in/list",
        method:"post",
        data:parameter
    })
}

//获取出库单详情
export function reqSaleOutReceiptDetail(purchaseId){
    return request({
        url:"/saleOutReceipt/in/detail",
        method:"get",
        params:{
            orderNo:purchaseId
        }
    })
}

//创建销售出库单
export function reqCreateSaleOut(parameter){
    return request({
        url:"/saleOutReceipt/create",
        method:"post",
        data:parameter
    })
}

// 创建并完成销售出库单
export function reqCreateInSaleOut(parameter){
    return request({
        url:"/saleOutReceipt/in/create",
        method:"post",
        data:parameter
    })
}

// 编辑销售出库单
export function reqUpdateSaleOut(parameter){
    return request({
        url:"/saleOutReceipt/update",
        method:"post",
        data:parameter
    })
}

//获取平台编码解析规则
export const reqScanCodeRuleInfo = (flagCode) => {
    if(!flagCode){
        flagCode = 'workOutWarehousing.handleBarcodeScan.new';
    }
    return axiosRequest({
        url:"/wms/stocks/scan/code/rule/get",
        method:"post",
        data:{
            code:flagCode
        },
        headers:{
            'jun-path':2
        }
    })
}

//生产订单列表接口
export function reqProductOrderList(parameter){
    return request({
        url:"/saleOutReceipt/list2",
        method:"post",
        data:parameter
    })
}
//生产订单详情
export function reqProductOrderDetail(productOrderNumber){
    return request({
        url:"/saleOutReceipt/detail2",
        method:"get",
        params:{
            productOrderNumber
        }
    })
}
//根据生产订单查询bom
export function reqBomByProductOrder(productOrderNumber){
    return request({
        url:"/saleOutReceipt/bom2",
        method:"get",
        params:productOrderNumber
    })
}

// 查询工单物料下的批次列表
export function reqBatchList(parameter){
    return request({
        url:"/stockAva/ava/quantity",
        method:"get",
        params:parameter
    })
}

// 查询单个批次号是否存在
// /stockAva/ava/select
export function reqBatchSelect(parameter){
    return request({
        url:"/stockAva/ava/select",
        method:"get",
        params:parameter
    })
}